package com.sky.mapper.admin;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sky.dto.PasswordEditDTO;
import com.sky.entity.Employee;
import com.sky.enumeration.AutoFill;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    @Select("select e.id,e.username,e.name,e.password,e.id_number,e.phone,e.sex,e.status,e.create_time,e.create_user,e.update_user,e.update_time  from sky_take_out.employee e where e.id = #{id}")
    Employee selectById(Integer id);

//    @AutoFill(OperationType.UPDATE)
    int updatePasswordByid(PasswordEditDTO PasswordEditDTO);

    List<Employee> selectByPageAndKeywords(String name);


    @AutoFill(OperationType.INSERT)
    int insertEmployeeInfo(Employee employee);

    @AutoFill(OperationType.UPDATE)
    int updateEmployee(Employee employee);

//    @AutoFill(OperationType.UPDATE)
    int setEmployeeStatusById(Integer status, Integer id);



}
